package project.controller;
import org.json.JSONObject;
import project.dao.ProjectDao;


import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
public class ProjectRejectServlet extends HttpServlet{
    private final ProjectDao projectDao = new ProjectDao();
    private static final long serialVersionUID = 1;

    public ProjectRejectServlet() {
        super();
    }

    protected void doGet(HttpServletRequest request, HttpServletResponse response)
            throws IOException, ServletException {
        doPost(request, response);
    }

    protected void doPost(HttpServletRequest request, HttpServletResponse response)
            throws IOException, ServletException {
        System.out.println("进入了ProjectRejectServlet");
        int id = Integer.parseInt(request.getParameter("id"));
        projectDao.rejectProject(id);
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("code",200);
        jsonObject.put("message","项目成功接受");
        System.out.println(jsonObject.toString());
        response.getWriter().write(jsonObject.toString());
    }
}
